#ifndef QFAULTWIDGET_H
#define QFAULTWIDGET_H

#include "../../libs/core/qabstractpagewidget.h"

#include <QTreeWidget>

#define FAULT_ADDRESS 0X0F32

class QMission;


class QFaultTreeWidget : public QTreeWidget
{
    Q_OBJECT
protected:
    void    drawRow(QPainter *painter, const QStyleOptionViewItem &options, const QModelIndex &index) const;
    void    contextMenuEvent(QContextMenuEvent *);

signals:
    void    show_menu(const QPoint &pt);

public:
    QTreeWidgetItem* m_menu_item;
};

class QFaultWidget: public QAbstractPageWidget
{
    Q_OBJECT
public:
    QFaultWidget(QWidget* parent=0);
protected slots:
    void    machine_status_changed();

    void    new_machine();
    void    clear_machine();

    void    online();
    void    offlie();

    void   mission_success(QMission* ms);

    void    show_menu(const QPoint &pt);

    void    remove_this();
    void    remove_all();
    void    remove_select();
    void    save_fault();
protected:
    QFaultTreeWidget     *m_current_status_list;
    QFaultTreeWidget     *m_history_status_list;

    QMission        *m_mission;

    QIcon           m_icon;
};

#endif // QFAULTWIDGET_H
